////////////////////////////////////////////////////////////////////////////////
// Copyright 2006 CORE Solutions Limited
// All rights reserved.
// PROPRIETARY AND CONFIDENTIAL INFORMATION.
// Use is subject to license terms.
//
// FUNCTION ID      :   UserQuery.java
// AUTHOR           :   ric.yik
// DATE CREATE      :   2006/6/20
// DESCRIPTION      :   
//                  :   
//                  :   
//                  :   
//
// MODIFICATION HISTORY:
// DATE         AUTHOR          VERSION NO.         COMMENT
// -----------  --------------  ------------------  -------------------
// 2006/6/20      ric.yik         1.0                 source is created.
//
//
//
////////////////////////////////////////////////////////////////////////////////

package com.erp.app.common.query;

import com.erp.app.admin.userSetup.pk.UserPk;

public class UserQuery extends BeanQuery {

    public UserQuery() {
        super("SELECT USER_CODE, USER_NAME FROM T_USER WHERE " +
                "COMPANY_CODE = `companyCode:string` AND " +
                "(ACTIVATION = `$GENERIC_ACTIVE:string` OR USER_CODE = `userCode:string`) AND " +
                "(NVL(APPROVER, `$GENERIC_NO:string`) = `approver:yesno` OR `$GENERIC_NO:string` = `approverSelected:yesno`) AND " +
                "(NVL(QA_HANDLER, `$GENERIC_NO:string`) = `qaHandler:yesno` OR `$GENERIC_NO:string` = `qaHandlerSelected:yesno`) AND " +
                "(NVL(QC_HANDLER, `$GENERIC_NO:string`) = `qcHandler:yesno` OR `$GENERIC_NO:string` = `qcHandlerSelected:yesno`) AND " +
                "(NVL(GMM, `$GENERIC_NO:string`) = `gmm:yesno` OR `$GENERIC_NO:string` = `gmmSelected:yesno`)");
    }

    public UserQuery setUserPk(UserPk pk) {
        this.setModel(pk);
        return this;
    }

    public UserQuery setCompanyCode(String companyCode) {
        return this.setUserPk(new UserPk(null, companyCode));
    }

}
